#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
using namespace std;

void test_01()
{
	string s1;
	string s2;
	cin >> s1;
	cin >> s2;
	cout << s1 << endl;
	cout << s2 << endl;
}

void test_getline()
{
	string s;
	getline(cin, s, '*');
	cout << "*************************************************" << endl;
	cout << s << endl;
}


int main(void)
{
	string s;
	getline(cin, s);
	size_t pos = s.rfind(' ');
	cout << s.size() - pos - 1 << endl;
	return 0;
}